﻿using System.Collections.Generic;

namespace MingYuanYun.Primitives
{
    public static class CollectionExtensions
    {
	    public static void AddRange<T>(this ICollection<T> collection, IEnumerable<T> values)
	    {
		    if (collection == null || values == null)
			    return;

		    var list = collection as List<T>;

		    if (list != null)
		    {
			    list.AddRange(values);
		    }
		    else
		    {
			    foreach (var value in values)
			    {
				    collection.Add(value);
			    }
		    }
	    }
	}
}
